<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>controlP5 : : ControlCanvas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
document.getElementsByTagName('html')[0].className = 'isjs';

function toggle(dt) 
{ 
  var display, dd=dt; 
  /* get dd */ 
  do{ dd = dd.nextSibling } while(dd.tagName!='DD'); 
  toOpen =!dd.style.display; 
  dd.style.display = toOpen? 'block':'' 
  dt.getElementsByTagName('span')[0].innerHTML 
    = toOpen? '-':'+' ; 
} 
</script>
</head>
<body>
<div id="container">
		<div id="header">
		<a href="./index.htm"><img src="./docuImages/title.jpg" /></a>
		</div>
	<div class="content">
		<h1>ControlCanvas</h1>
		<dl><dt class="key">description</dt><dd class="value">be warned, for now ControlCanvas and ControlWindowCanvas are EXPERIMENTAL and 
 will undergo changes in the future! 
 use a controlWindowCanvas to draw your own content into a control window.</dd></dl>
			
			<div class="toggleList example">
				<dl><dt onclick="toggle(this)"><span>+</span>Example</dt>
					<dd><pre>import controlP5.*;

/**
  * WARNING
  * ControlCanvas and ControlWindowCanvas are yet EXPERIMENTAL
  * and therefore will undergo changes in the future before being
  * fully functional!
  */
  
ControlP5 controlP5;
  
void setup() {
  size(400,400);
  frameRate(30);

  controlP5 = new ControlP5(this);
  ControlGroup l = controlP5.addGroup("myGroup",100,40);
  l.addCanvas(new TestCanvas());
}

void draw() {
  background(0);
}


void controlEvent(ControlEvent theEvent) {
  println("got an event from "+theEvent.controller().name());
}


class TestCanvas extends ControlCanvas {
  TestCanvas() {
  }
  
  public void draw(PApplet theApplet) {
    theApplet.fill(int(random(244)));
    theApplet.rect(0,0,100,100);
  }
}
</pre></dd>
				</dl>
			</div>
			
			
			
			<dl><dt class="key">constructors</dt><dd class="value"><pre>ControlCanvas();
</pre></dd></dl>
			
			
			
			
			
			
			
			<!-- METHODS:BEGIN -->
			
       <dl class="noborder"><dt>Methods</dt></dl>
       <dl><dt class="key"><a href="controlcanvas_method_draw.htm">draw ( )</a></dt><dd class="value">controlCanvas is an abstract class and therefore needs to be
 extended by your class. draw(PApplet theApplet) is the only method that
 needs to be overwritten.</dd></dl>
<dl><dt class="key"><a href="controlcanvas_method_mode.htm">mode ( )</a></dt><dd class="value">get the drawing mode of a ControlWindowCanvas. this can be PRE or POST.</dd></dl>
<dl><dt class="key"><a href="controlcanvas_method_post.htm">post ( )</a></dt><dd class="value">set the drawing mode to POST.</dd></dl>
<dl><dt class="key"><a href="controlcanvas_method_pre.htm">pre ( )</a></dt><dd class="value">set the drawing mode to PRE. PRE is the default.</dd></dl>

   
			<!-- METHODS:END -->
			<div class="separator">
			<dl><dt class="key">usage</dt><dd class="value">Web & Application</dd></dl>
			</div>
			<div class="separator">
			<dl><dt class="key">related</dt><dd class="value"><ul></ul></dd></dl>
			</div>
	</div>
	<div id="footer">
	<p>by andreas schlegel (<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">cc</a>) 2007, <a href="http://www.sojamo.de" target="_blank">sojamo</a>.</p>
	</div>
</div>
</body>
</html>


